package com.jet.rtdb.socket.client.mina;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 * @Author: zhangkaifeng.
 * @CreateTime: 2017/8/23 11:02
 * @Description:
 */


public class MyCodecFactory implements ProtocolCodecFactory{

    private RtdbProtocolEncoder rtdbProtocolEncoder;
    private RtdbProtocolDecoder rtdbProtocolDecoder;

    public MyCodecFactory() {
        this.rtdbProtocolEncoder = new RtdbProtocolEncoder();
        this.rtdbProtocolDecoder = new RtdbProtocolDecoder();
    }

    @Override
    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return rtdbProtocolEncoder;
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return rtdbProtocolDecoder;
    }
}
